/**   
* @Title: ResultEnum.java
* @Package org.xaoyaoyao.spider.enums
* @Description: TODO
* @author xaoyaoyao
* @date Jan 25, 2019 11:18:48 AM
* @version V1.0   
*/
package org.xaoyaoyao.spider.enums;

/**
 * @ClassName: ResultEnum
 * @Description: TODO
 * @author xaoyaoyao
 * @date Jan 25, 2019 11:18:48 AM
 * 
 */
public enum ResultEnum {

	SUCCESS(200, "成功"), ERROR(500, "失败");

	private int code;

	private String remarks;

	ResultEnum(int code, String remarks) {
		this.code = code;
		this.remarks = remarks;
	}

	/**
	 * @return the code
	 */
	public int getCode() {
		return code;
	}

	/**
	 * @return remarks
	 */
	public String getRemarks() {
		return remarks;
	}

	public static ResultEnum from(int code) {
		ResultEnum[] values = ResultEnum.values();
		for (ResultEnum v : values) {
			if (code == v.getCode()) {
				return v;
			}
		}
		return null;
	}
}
